import axios from '../axios'

const ROLE = '/role'

export default {
    addRole({ name, description, permIds }) {
        const arr = permIds.map(item => `&permIds=${item}`).join('')
        return axios({
            url: ROLE + `/add?name=${name}&description=${description}${arr}&status=y`,
            method: 'POST',
        })
    },
    delRole(params) {
        return axios({
            url: ROLE + '/del',
            method: 'POST',
            params
        })
    },
    getRoleOne(id) {
        return axios({
            url: ROLE + '/view/' + id,
            method: 'GET',
        })
    },
    getRoleList(data) {
        return axios({
            url: ROLE + '/list',
            method: 'POST'
        })
    }

}